0c76325564ca6b09a3f126ad8d21c677e387ceb5
[nextcloud-desktop.git] /
1 /*
2  * Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12  * for more details.
13  */
14
15 import FileProvider
16 import Foundation
17 import NextcloudKit
18 import NextcloudFileProviderKit
19 import OSLog
20
21 extension FileProviderExtension: NSFileProviderThumbnailing {
22     func fetchThumbnails(
23         for itemIdentifiers: [NSFileProviderItemIdentifier],
24         requestedSize size: CGSize,
25         perThumbnailCompletionHandler: @escaping (
26             NSFileProviderItemIdentifier,
27             Data?,
28             Error?
29         ) -> Void,
30         completionHandler: @escaping (Error?) -> Void
31     ) -> Progress {
32         return NextcloudFileProviderKit.fetchThumbnails(
33             for: itemIdentifiers,
34             requestedSize: size,
35             usingRemoteInterface: self.ncKit,
36             perThumbnailCompletionHandler: perThumbnailCompletionHandler,
37             completionHandler: completionHandler
38         )
39     }
40 }